package com.KegController.BrewCoder;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

public class startService extends Activity {

	private static final String USB_ACCESSORY_ATTACHED = "android.hardware.usb.action.USB_ACCESSORY_ATTACHED";

	private static final String TAG = "startServiceActivity";

	// Start adkService if the adk board was just plugged in
	@Override
	public void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		String action = getIntent().getAction();
		Log.d(TAG, "ONSTART action: " + action);
		if (action.equals(USB_ACCESSORY_ATTACHED)) {
			Intent i = new Intent(this, adkService.class);
			i.putExtras(getIntent());
			startService(i);
			
		}// else {
			Intent i = new Intent(this, KegControllerActivity.class);
			i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
					| Intent.FLAG_ACTIVITY_CLEAR_TOP);
			startActivity(i);
	//	}
this.finish();
	}

}
